import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import App from './App.vue'
import router from './router'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import './styles/ant-theme.css'
import './styles/global.scss'
import VChart from 'vue-echarts'

const app = createApp(App)
const pinia = createPinia()

pinia.use(piniaPluginPersistedstate)

// 先挂载 pinia，再挂载路由
app.use(pinia)
app.use(router)
app.use(Antd)
app.component('v-chart', VChart)

// 等待路由就绪后再挂载应用
router.isReady().then(() => {
  app.mount('#app')
}) 